mk=angular.module("app",['ui.router'])
mk.config(function($stateProvider,$urlRouterProvider){
	$urlRouterProvider.when("","a")
	var a={
		"name":"a",
		"url":"/a",
		"templateUrl":"tpl/a.html",
		"controller":"one",
	}
	var b={
		"name":"b",
		"url":"/b",
		"templateUrl":"tpl/b.html"
	}
	var c={
		"name":"c",
		"url":"/c",
		"templateUrl":"tpl/c.html"
	}
	var d={
		"name":"d",
		"url":"/d",
		"templateUrl":"tpl/d.html"
	}
	$stateProvider.state(a)
	$stateProvider.state(b)
	$stateProvider.state(c)
	$stateProvider.state(d)
})
mk.controller('one',['$scope',function($scope){
	dataStr=localStorage.getItem('ly')
	if(dataStr){
		dataObj=JSON.parse(dataStr)
		$scope.zhi=dataObj.info
	}else{
		localStorage.setItem('ly','{"info":[]}')
	}
	$scope.add=function(){
		
		dataStr=localStorage.getItem('ly')
		dataObj=JSON.parse(dataStr)
		dataObj.info.push({"title":$scope.title,"content":$scope.content,"gongsi":$scope.gongsi,"danxuan":$scope.danxuan,"yaoqiu":$scope.yaoqiu})
		$scope.zhi=dataObj.info
		dataStr=JSON.stringify(dataObj)
		localStorage.setItem('ly',dataStr)
		$scope.title=""
		$scope.content=""
		$scope.gongsi=""
		$scope.yaoqiu=""
	}
	$scope.del=function(index){
		dataObj.info.splice(index,1)
		$scope.zhi=dataObj.info
		dataStr=JSON.stringify(dataObj)
		localStorage.setItem('ly',dataStr)
	}
	$scope.ditu=function(){
		var map = new BMap.Map("allmap");    // 创建Map实例
		map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
		//添加地图类型控件
		map.addControl(new BMap.MapTypeControl({
			mapTypes:[
	            BMAP_NORMAL_MAP,
	            BMAP_HYBRID_MAP
	        ]}));	  
		map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
		map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
		}
}])